package org.link.service;

import java.util.List;
import java.util.UUID;

import javax.annotation.Resource;

import org.link.bean.Page;
import org.link.bean.User;
import org.link.mapper.UserMapper;
import org.springframework.stereotype.Service;

/**
 * 
 * project_name:oracledemo
 * package_name:org.link.service
 * file_name:UserService.java
 * @author Link
 * create_date:2015年12月24日 下午4:20:21
 * modified_date:
 * description:业务层
 *
 */
@Service
public class UserService implements IUserService {

	@Resource
	private UserMapper userDao;
	
	public void addUser(User user) {
		user.setId(UUID.randomUUID().toString());
		userDao.addUser(user);
	}

	public List<User> selectUserByLimit(Page page) {
		return userDao.selectUserByLimit(page);
	}

	/**
	 * 返回页面总数
	 */
	public int selectCount() {
		int totalCount = userDao.selectCount();
		int totalPage = 0;
		if(totalCount%5==0){
			totalPage = totalCount/5;
		}else{
			totalPage = totalCount/5+1;
		}
		return totalPage;
	}

	
	
}
